<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title><!--{$lang.page.index.title}--></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/lay/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/lay/layui/index.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-body" style="padding: 15px;">
        <div class="layui-form-item" style="text-align: center;"><b><!--{$lang.page.table.batchadd}--></b></div>
        <form name="addItem" method="post" lay-filter="component-form-group" class="layui-form">
          <input type="hidden" name="type" value="2">
          <input type="hidden" name="grade" value="member">
          <input type="hidden" name="ranges" value="0">
          <input type="hidden" name="roletype" value="2">
          <div class="layui-form-item">

            <div class="layui-inline">
              <label class="layui-form-label"><!--{$lang.page.table.number}--></label>
              <div class="layui-input-inline">
               <input type="text" name="number" value="20" lay-verify="number" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>

            <div class="layui-inline">
             <label class="layui-form-label"><!--{$lang.page.public.password}--></label>
              <div class="layui-input-inline">
                <input type="text" name="password" value="cs123999" lay-verify="password" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>

            <div class="layui-inline">
             <label class="layui-form-label"><!--{$lang.page.public.paypwd}--></label>
              <div class="layui-input-inline">
                <input type="text" name="paypwd" value="888888" lay-verify="paypwd" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>

            <div class="layui-inline">
              <label class="layui-form-label"><!--{$lang.page.public.min}--> <!--{$lang.page.table.money}--></label>
              <div class="layui-input-inline">
               <input type="text" name="minmoney" value="2000" lay-verify="minmoney" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>

            <div class="layui-inline">
             <label class="layui-form-label"><!--{$lang.page.public.max}--> <!--{$lang.page.table.money}--></label>
              <div class="layui-input-inline">
                <input type="text" name="maxmoney" value="5000" lay-verify="maxmoney" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>

            </div>

            <div class="layui-form-item">
              <div class="layui-inline">
                <label class="layui-form-label"><!--{$lang.page.table.type}--></label>
                <div class="layui-input-inline" >
                  <input type="text" value="会员" lay-verify="realname" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" disabled/>
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label"><!--{$lang.page.table.header}--></label>
                <div class="layui-input-inline" >
                  <input type="radio" name="header" value="1" title="<!--{$lang.page.table.no}-->" >&nbsp;&nbsp;<input type="radio" name="header" value="2" title="<!--{$lang.page.table.yes}-->" checked>
                </div>
              </div>
            </div>
            
                  
          <div class="layui-form-item layui-layout-admin">
              <div class="layui-footer" style="left: 0;">
                <button class="layui-btn" type="button" id="submit" lay-submit lay-filter="submit"><!--{$lang.page.public.submit}--></button>
                <button type="button" class="layui-btn layui-btn-primary" onClick="xadmin.close();" ><!--{$lang.page.table.back}--></button>
              </div>
          </div>

        </form>
      </div>
    </div>
<script src="/static/lay/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
     base: '/static/lay/' //静态资源所在路径
   }).extend({
     xadmin: 'lib/xadmin' //弹窗
   }).use(['jquery', 'layer','xadmin', 'form', 'element', 'upload'], function(){
    var form = layui.form
       ,upload = layui.upload;
    form.render(null, 'component-form-group');

    /* 自定义验证规则 */
    // var mobile = /^0[9]\d{8}$/,phone = /^0\d{2,3}-?\d{7,8}$/;
    var mobile = /^\d{6,13}$/;
    // var mobile = /^0[1357]\d{8,9}$/; //越南手机号验证
    var paypwd = /^\d+$/;
    var password = /^[A-Za-z0-9]+$/
    form.verify({

      number: function(value){
        if(value.length < 1){
          return '数量不能为空';
        }
      }
      ,password: function(value){
        if(value.length>1){
          var flag = password.test(value);
          if(value.length <6 || value.length >16){
             return '请输入正确的密码，密码为6-16位数字字母组合';
          }
          if(!flag){
              return '请输入正确的密码，密码为6-16位数字字母组合';
          }
        }     
      }
      ,paypwd: function(value){
        if(value.length>1){
          var flag = paypwd.test(value);
          if(value.length != 6 ){
             return '请输入正确的支付密码，支付密码为6位数字';
          }
          if(!flag){
              return '请输入正确的支付密码，支付密码为6位数字';
          }
        }  
      }
    });

    form.on('submit(submit)', function (data) {
        layer.alert('确定生成机器人账户？', {
                offset:'100px'
                , closeBtn: 1 // 是否显示关闭按钮
                , anim: 1 //动画类型
                , btn: ['<!--{$lang.page.table.confirm}-->', '<!--{$lang.page.table.cancel}-->'] //按钮
                , icon: 6 // icon
                , yes: function () {
                    $('#delall').attr("disabled",true);
                    $('#delall').addClass('layui-btn-disabled');
                    $.post('#',data.field,function(res){
                        if(res.code == 200){
                            layer.msg(res.msg);
                            setTimeout(() => {
                                window.location.reload();
                                // xadmin.close();
                            }, 1000);
                        }else{
                          $('#delall').removeAttr("disabled");
                          $('#delall').removeClass('layui-btn-disabled');
                          layer.msg(res.msg);
                        }
                    })
                }
            });
    });

  });

</script>
</body>
</html>

